/**
    ATClab - scriptable Air Traffic Control simulations.
    Copyright (C) 2010 openatclab@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef __ATC_AREA_DEFINITION_HDR__
#define __ATC_AREA_DEFINITION_HDR__

#include <string>
#include <vector>


namespace atc{

	/*!
	 *
	 */
	struct AreaDescriptor;


	/*!
	 *
	 */
	struct AreaDefinition {

		AreaDefinition();
		AreaDefinition( const char * );
		~AreaDefinition();

		std::vector< atc::AreaDescriptor* >::const_iterator	begin() const {
			return descriptors.begin();
		}
		std::vector< atc::AreaDescriptor* >::const_iterator	end() const {
			return descriptors.end();
		}

		std::string uid;
		std::vector< atc::AreaDescriptor* > descriptors;

		typedef std::vector< atc::AreaDescriptor* >::const_iterator const_iterator;
	};


	/*!
	 *
	 */
	struct SectorDefinition : public AreaDefinition {

		SectorDefinition() : AreaDefinition(), active( false ) {}
		SectorDefinition( const char *uid ) 
			  : AreaDefinition( uid ), active( false ) {}

		void set_active() { active = true; }

		bool active;
	};


	/*!
	 * 
	 */
	struct AreaDescriptor {

		enum { 
				RTTI_VERTEX
			  , RTTI_ARC
			  , RTTI_ELLIPSE
		};
		
		AreaDescriptor( double x, double y, int rtti = RTTI_VERTEX )
			:x(x), y(y), rtti(rtti) {}
		virtual ~AreaDescriptor() {};

        double x;
        double y;
        int rtti;
    };


	/*!
	 * 
	 */
	typedef atc::AreaDescriptor VertexDescriptor;


	/*!
	 * 
	 */
	struct ArcDescriptor : public AreaDescriptor{

		ArcDescriptor( double x, double y, double r )
			:AreaDescriptor( x, y, RTTI_ARC ), r(r) {}

		double r;
	};

	/*!
	 * 
	 */
	struct EllipseDescriptor : public AreaDescriptor{

		EllipseDescriptor( double x, double y, double w, double h, double a )
			:AreaDescriptor( x, y, RTTI_ELLIPSE ), w(w), h(h), a(a) {}

		double w;
		double h;
		double a;
	};


	/*!
	 *
	 */
	typedef atc::AreaDescriptor SectorDescriptor;

}
#endif
